package com.cndatacom.eweb.dao.impl;

import com.cndatacom.eweb.common.PaginationModel;
import com.cndatacom.eweb.common.PaginationSupport;
import com.cndatacom.eweb.dao.IRightBitDao;
import com.cndatacom.eweb.model.RightBit;

public class RightBitDao extends PaginationSupport implements IRightBitDao {

	public boolean addOrUpdateRightBit(RightBit rightBit) {
		getHibernateTemplate().saveOrUpdate(rightBit);
		return true;
	}

	public boolean deleteRightBit(RightBit rightBit) {
		getHibernateTemplate().delete(rightBit);
		return true;
	}

	public PaginationModel getAllRightBit(int offset, int pageSize, boolean paging) {
		return searchPaginated("select rb from RightBit rb order by rb.id desc", null, offset, pageSize, paging);
	}

	public RightBit getRightBitById(int id) {
		return (RightBit)getHibernateTemplate().get(RightBit.class, id);
	}

}

